<template>
  <!-- keep-alive 缓存组件内容 -->
  <router-view v-slot="{Component}">
    <transition name="slide-fade" mode="out-in">
      <keep-alive>
        <component :is="Component" v-if="$route.meta.keepAlive" :key="$route.meta.title" />
      </keep-alive>
    </transition>
    <transition name="slide-fade" mode="out-in">
      <component :is="Component" v-if="!$route.meta.keepAlive" />
    </transition>
  </router-view>
</template>


<style type="text/css">
.slide-fade-enter-active{
  transition: all 0.3s ease-out;
}
.slide-fade-leave-active{
  transition: all 0.3s cubic-bezier(1,0.5,0.8,1);
}
.slide-fade-enter-to{
  transform: translateX(0px);
  opacity: 1;
}
.slide-fade-enter-from,
.slide-fade-leave-to {
  transform: translateX(-50px);
  opacity: 0;
}
</style>